<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itheima" uri="http://itheima.com/common/"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName()
            + ":" + request.getServerPort() + path + "/";
%>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">权限管理</h1>
    </div>
    <!-- /.col-lg-12 -->
    <div class="row">
        <div class="col-lg-2">
                <!--zTree-->
                <ul id="functionTree" class="ztree"></ul>
        </div>
        <div class="col-lg-10">
            <!--内容-->
                <div id="detailContent">

                </div>
        </div>
    </div>

</div>
<!-- /.row -->

</div>
<!-- 客户列表查询部分 end-->

<!-- 创建客户模态框 -->

<!-- 修改客户模态框 -->
<!--zTree -->
<link href="<%=basePath%>zTree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<script src="<%=basePath%>js/jquery-1.11.3.min.js"></script>
<script src="<%=basePath%>zTree/js/jquery.ztree.core.js"></script>
<script src="<%=basePath%>zTree/js/jquery.ztree.excheck.js"></script>
<!-- 编写js代码 -->
<script type="text/javascript">
    var zTreeObj;
    // zTree 的参数配置，深入使用请参考 API 文档（setting 配置详解）
    var setting = {

        data: {
            simpleData: {
                enable: true,
                idKey: "id",
                pIdKey: "pId",
                rootPId: 0
            }
        },
        callback:{
            onClick:chooseNode,
        }
    };
    $.ajax({
        type: "post",
        url: "${pageContext.request.contextPath }/right/finAllFunctionNodes.action",
        success: function (data) {
            // zTree 的数据属性，深入使用请参考 API 文档（zTreeNode 节点数据详解）
            var zNodes = data
            zTreeObj = $.fn.zTree.init($("#functionTree"), setting, zNodes);
        }
    });
    function chooseNode(event,treeId,treeNode){
        //alert(treeNode.id);
        var url="${pageContext.request.contextPath }/right/findFunctionById.action";
        $.post(
            url
            ,{"id":treeNode.id}
            ,function (data){
            $("#detailContent").html(data);
        })

    }
</script>
</body>
</html>